<?php

namespace App\Models\Strator;

use App\Models\Traits\DateTimeTrait;
use App\Models\Traits\ModelSearchTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class StratorInventory extends Model
{
    use SoftDeletes, DateTimeTrait, ModelSearchTrait;

    protected $dateFormat = 'Y-m-d H:i:s';
    protected $guarded = [];
    protected $table = 'strator_inventorys'; // 使用的表名，不配置会使用类名作为默认

    //
    public function searchConditions():array{
        return [
            ['batch_no','like'],
            ['contents','like'],
            ['supplier_name','like'],
            ['customer_name','like'],
            ['department_name','like'],
            ['type','='],
            ['status','='],
            ['in_type','='],
            ['out_type','='],
            ['is_sale','='],
        ];
    }
    //
    public function detail(){
        return $this->hasMany(StratorInventoryDetail::class,'order_sn','order_sn');
    }

}
